home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tex / style / misc / remark.sty < prev    next >
Text File  |  1995-11-25  |  5KB  |  131 lines

  1. %       ****************************************
  2. %       *         REMARK ENVIRONMENTS         *
  3. %       ****************************************
  4. %
  5. %  The user creates his own remark-like environments with the command
  6. %      \newremark{NAME}{TEXT}[COUNTER]  or
  7. %      \newremark{NAME}[OLDNAME]{TEXT}
  8. %  This defines the environment NAME to be just as one would expect a 
  9. %  remark environment to be, except that it prints ``TEXT'' instead of 
  10. %  ``Remark''.  
  11. %
  12. %  If OLDNAME is given, then environments NAME and OLDNAME use the same 
  13. %  counter, so using a NAME environment advances the number of the next 
  14. %  NAME environment, and vice-versa.
  15. %  
  16. %  If COUNTER is given, then environment NAME is numbered within COUNTER.
  17. %  E.g., if COUNTER = subsection, then the first NAME in subsection 7.2
  18. %  is numbered TEXT 7.2.1.
  19. %  
  20. %  The way NAME environments are numbered can be changed by redefining
  21. %  \theNAME.
  22. %
  23. %  DOCUMENT STYLE PARAMETERS
  24. %
  25. %  \@rmkcounter{COUNTER} : A command such that
  26. %               \edef\theCOUNTER{\@rmkcounter{COUNTER}}
  27. %         defines \theCOUNTER to produce a number for a remark environment.
  28. %         The default is:
  29. %            BEGIN \noexpand\arabic{COUNTER} END
  30. %
  31. %  \@rmkcountersep : A separator placed between a remark number and
  32. %         the number of the counter within which it is numbered.
  33. %         E.g., to make the third remark of section 7.2 be numbered
  34. %         7.2-3, \@rmkcountersep should be \def'ed to '-'.  Its
  35. %         default is '.'.
  36. %
  37. %  \@beginremark{NAME}{NUMBER} : A command that begins a remark
  38. %         environment for a 'remark' named 'NAME NUMBER' --
  39. %         e.g., \@beginremark{Lemma}{3.7} starts Lemma 3.7.
  40. %      
  41. %  \@opargbeginremark{NAME}{NUMBER}{OPARG} : A command that begins a remark
  42. %         environment for a 'remark' named 'NAME NUMBER' with optional
  43. %         argument OPARG -- e.g., \@beginremark{Lemma}{3.7}{Jones}
  44. %         starts `Lemma 3.7 (Jones):'.
  45. %      
  46. %  \@endremark : A command that ends a remark environment.
  47. %
  48. % \newremark{NAME}{TEXT}[COUNTER] ==
  49. %   BEGIN
  50. %     if \NAME is definable
  51. %       then \@definecounter{NAME}
  52. %            if COUNTER present
  53. %              then \@addtoreset{NAME}{COUNTER} fi
  54. %                   \theNAME ==  BEGIN \theCOUNTER \@rmkcountersep
  55. %                                       eval\@rmkcounter{NAME}      END
  56. %              else \theNAME ==  BEGIN eval\@rmkcounter{NAME} END
  57. %            \NAME == \@rmk{NAME}{TEXT}
  58. %            \endNAME == \@endremark
  59. %       else  error
  60. %     fi
  61. %   END
  62. %
  63. % \newremark{NAME}[OLDNAME]{TEXT}==
  64. %   BEGIN
  65. %     if \NAME is definable
  66. %       then \theNAME == \theOLDNAME
  67. %            \NAME == \@rmk{OLDNAME}{TEXT}
  68. %            \endNAME == \@endremark
  69. %       else  error
  70. %     fi
  71. %   END
  72. %
  73. % \@rmk{NAME}{TEXT} ==
  74. %   BEGIN
  75. %    \refstepcounter{NAME}
  76. %    if next char = [ 
  77. %       then \@yrmk{NAME}{TEXT}
  78. %       else \@xrmk{NAME}{TEXT}
  79. %    fi
  80. %   END
  81. %
  82. % \@xrmk{NAME}{TEXT} ==
  83. %   BEGIN
  84. %    \@beginremark{TEXT}{\theNAME}
  85. %    \ignorespaces
  86. %   END
  87. %
  88. % \@yrmk{NAME}{TEXT}[OPARG] ==
  89. %   BEGIN
  90. %    \@opargbeginremark{TEXT}{\theNAME}{OPARG}
  91. %    \ignorespaces
  92. %   END
  93. %
  94. \def\newremark#1{\@ifnextchar[{\@ormk{#1}}{\@nrmk{#1}}}
  95.  
  96. \def\@nrmk#1#2{%
  97. \@ifnextchar[{\@xnrmk{#1}{#2}}{\@ynrmk{#1}{#2}}}
  98.  
  99. \def\@xnrmk#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname
  100. {\@definecounter{#1}\@addtoreset{#1}{#3}%
  101. \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand
  102.   \csname the#3\endcsname \@rmkcountersep \@rmkcounter{#1}}%
  103. \global\@namedef{#1}{\@rmk{#1}{#2}}\global\@namedef{end#1}{\@endremark}}}
  104.  
  105. \def\@ynrmk#1#2{\expandafter\@ifdefinable\csname #1\endcsname
  106. {\@definecounter{#1}%
  107. \expandafter\xdef\csname the#1\endcsname{\@rmkcounter{#1}}%
  108. \global\@namedef{#1}{\@rmk{#1}{#2}}\global\@namedef{end#1}{\@endremark}}}
  109.  
  110. \def\@ormk#1[#2]#3{\expandafter\@ifdefinable\csname #1\endcsname
  111.   {\global\@namedef{the#1}{\@nameuse{the#2}}%
  112. \global\@namedef{#1}{\@rmk{#2}{#3}}%
  113. \global\@namedef{end#1}{\@endremark}}}
  114.  
  115. \def\@rmk#1#2{\refstepcounter
  116.     {#1}\@ifnextchar[{\@yrmk{#1}{#2}}{\@xrmk{#1}{#2}}}
  117.  
  118. \def\@xrmk#1#2{\@beginremark{#2}{\csname the#1\endcsname}\ignorespaces}
  119. \def\@yrmk#1#2[#3]{\@opargbeginremark{#2}{\csname
  120.        the#1\endcsname}{#3}\ignorespaces}
  121.  
  122. %DEFAULT VALUES
  123. \def\@rmkcounter#1{\noexpand\arabic{#1}}
  124. \def\@rmkcountersep{.}
  125. %deleted September 2, 1986 MDK
  126. %\def\@makermknumber#1#2{\bf #1 #2:}
  127. \def\@beginremark#1#2{\trivlist \item[\hskip \labelsep{\bf #1\ #2}]}
  128. \def\@opargbeginremark#1#2#3{\trivlist
  129.       \item[\hskip \labelsep{\bf #1\ #2\ (#3)}]}
  130. \def\@endremark{\endtrivlist}
  131.